using System;

namespace ClearSpringNet.Stream.Cardinality
{
    public interface ICardinality
    {
        /// <summary>
        /// return false if the value returned by cardinality() is unaffected by the appearance of o in the stream. 
        /// </summary>
        /// <param name="objectOffered"></param>
        /// <returns></returns>
        bool Offer(Object objectOffered);

        /// <summary>
        /// return the number of unique elements in the stream or an estimate thereof
        /// </summary>
        /// <returns></returns>
        long Cardinality();

        /// <summary>
        /// Size in bytes needed for serialization
        /// </summary>
        /// <returns></returns>
        int SizeOf();

        byte[] GetBytes();
        
        /// <summary>
        /// Merges estimators to produce an estimator for the combined streams
        /// of this estimator and those passed as arguments
        /// 
        /// </summary>
        /// <param name="estimators"></param>
        /// <returns></returns>
        ICardinality Merge(params ICardinality[] estimators);
    }
}